package com.zb.frame.modules.monitor.utils;

import com.zb.frame.base.upgrade.common.UpgradeHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;

public class UpgradeUtils {

    private  static Logger logger = LoggerFactory.getLogger(UpgradeUtils.class);

    /**
     * 检验表是否存在
     * @param conn
     * @param tableName
     * @return
     */
    public static boolean checkTableExist(Connection conn, String tableName, String tips) {
        String sqlCheck = "select 1 from " + tableName + " where 1!=1";
        boolean flag = UpgradeHelper.checkExist(conn, sqlCheck);
        if(flag)
            logger.debug( tips + " create table【" + tableName + "】 has exist in database.");
        return flag;
    }

    

}
